#define _CRT_SECURE_NO_WARNINGS

class Solution {
public:
    int massage(vector<int>& nums) {
        int n = nums.size();
        vector<int> dp(n + 3);

        for (int i = 3; i < n + 3; i++)
            dp[i] = max(dp[i - 2], dp[i - 3]) + nums[i - 3];

        return max(dp[n + 2], dp[n + 1]);
    }
};